﻿Imports System.Data.OleDb

Public Class AddNewTestForm
    Public acsconn As New OleDbConnection
    Public acsdr As OleDbDataReader
    Public strsql As String

    'Variable to hold members age
    Private AgeSet As String
    Public ReadOnly Property agegrab() As String
        Get
            AgeSet = Me.cboAge.Text
        End Get
    End Property
    'Function to connect database and open it.
    Sub connect()
        acsconn.ConnectionString = "Provider=Microsoft.ace.oledb.12.0; data source=C:\Users\DJWalshy\Documents\User_Log.accdb"
        acsconn.Open()
    End Sub
    Sub fillSitupCombo()
        For Index = 0 To 100
            cboSitup.Items.Add(Index)
        Next
    End Sub
    Sub fillPushupCombo()
        For Index = 0 To 100
            cboPushup.Items.Add(Index)
        Next
    End Sub
    Sub fillACCombo()
        For Index = 20 To 50 Step 0.5
            cboAC.Items.Add(Index)
        Next
    End Sub
    Sub fillRuntimeCombo()
        With cboRuntime.Items
            .Add("5:00")
            .Add("5:01")
            .Add("5:02")
            .Add("5:03")
            .Add("5:04")
            .Add("5:05")
            .Add("5:06")
            .Add("5:07")
            .Add("5:08")
            .Add("5:09")
            .Add("5:10")
            .Add("5:11")
            .Add("5:12")
            .Add("5:13")
            .Add("5:14")
            .Add("5:15")
            .Add("5:16")
            .Add("5:17")
            .Add("5:18")
            .Add("5:19")
            .Add("5:20")
            .Add("5:21")
            .Add("5:22")
            .Add("5:23")
            .Add("5:24")
            .Add("5:25")
            .Add("5:26")
            .Add("5:27")
            .Add("5:28")
            .Add("5:29")
            .Add("5:30")
            .Add("5:31")
            .Add("5:32")
            .Add("5:33")
            .Add("5:34")
            .Add("5:35")
            .Add("5:36")
            .Add("5:37")
            .Add("5:38")
            .Add("5:39")
            .Add("5:40")
            .Add("5:41")
            .Add("5:42")
            .Add("5:43")
            .Add("5:44")
            .Add("5:45")
            .Add("5:46")
            .Add("5:47")
            .Add("5:48")
            .Add("5:49")
            .Add("5:50")
            .Add("5:51")
            .Add("5:52")
            .Add("5:53")
            .Add("5:54")
            .Add("5:55")
            .Add("5:56")
            .Add("5:57")
            .Add("5:58")
            .Add("5:59")
        End With
    End Sub
    Sub determineAge()
        Dim I As String = cboAge.Text

        Select Case I
            Case 0 To 29
                AgeSet = 1
                ' The following is the only Case clause that evaluates to True.
            Case 30 To 39
                AgeSet = 2
            Case 40 To 49
                AgeSet = 3
            Case 50 To 59
                AgeSet = 4
            Case 60 To 100
                AgeSet = 5
            Case Else
        End Select

    End Sub
    Private Sub AddNewTestForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'User_LogDataSet.M30_39_Chart' table. You can move, or remove it, as needed.
        Me.connect()
        Me.loadAge()
    End Sub
    Sub loadAge()
        For Index = 16 To 99
            cboAge.Items.Add(Index)
        Next
    End Sub
    Private Sub cboAge_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles cboAge.SelectedIndexChanged
        Me.determineAge()
        Me.fillPushupCombo()
        Me.fillSitupCombo()
        Me.fillACCombo()
        Me.fillRuntimeCombo()
    End Sub
    Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
        TestScore.Show()

    End Sub
End Class